# -- coding: utf-8 --
"""
# ---------------问题:[‘abc13’,‘abv89’] 这种列表，打印最大长度的共同的前缀，列表元素个数不确定
"""
# 不会做，给的答案
# def longest_common_prefix(strs):
#     if not strs:
#         return ""
#     print(strs)
#     # 找到最短的字符串,min_str是字符串类型
#     min_str = min(strs, key=len)
#     print(type(min_str), min_str)
#
#     # 遍历最短字符串的每个字符
#     for i, char in enumerate(min_str):
#         # 检查所有字符串的当前字符是否相同
#         print(i, char)
#         for other in strs:
#             print(other)
#             if other[i] != char:
#                 return min_str[:i]
#
#     # 如果所有字符都匹配，返回最短字符串
#     return min_str
#
#
# # 测试用例
# strs = ['abc13', 'abv89']
# print(longest_common_prefix(strs))  # 输出: 'ab'

# 自己又练习写的
# def find_longest_prefix(strings):
#     if len(strings) == 0:
#         return ''
#     duan_str = min(strings, key=len)
#     for i, char in enumerate(duan_str):
#         for string in strings:
#             if string[i] != char:
#                 return duan_str[:i]
#     # 如果所有字符都匹配，返回最短字符串
#     return duan_str
#
#
#
# asstrs = ['qwer123', 'qwer123fd111']
# print(find_longest_prefix(asstrs))
"""
问题：任选语言完成双向冒泡排序算法程序（[8,6,4,3,9,1,2,5,7] 升序）
"""